################################
rm md5.txt -f
rm app_driver.tar.bz2 -f
rm update.tar.gz -f

chmod 755 * -R

dos2unix *.sh *.txt ./app_driver/scripts/* ./app_driver/profile/* ./app_driver/*.sh ./app_driver/driver/*.sh ./app_driver/udev/*

chmod +w ./app_driver/lib.tar.gz
tar -xzvf ./app_driver/lib.tar.gz -C ./app_driver/
rm ./app_driver/lib.tar.gz -f
mv ./app_driver/web/self* ./app_driver/
cp ./app_driver/profile/trace_cfg.ini ./app_driver/trace_network.ini
mv ./app_driver/profile/trace_cfg.ini ./app_driver/
cp ./app_driver/profile/CARRIER_BOARD_TYPE .

tar jcvf app_driver.tar.bz2 app_driver
md5sum app_driver.tar.bz2  > md5.txt
tar -czf update.tar.gz app_driver.tar.bz2 md5.txt update.sh config.json CARRIER_BOARD_TYPE
openssl enc -p -aes-256-cbc -base64 -salt -pass file:./key.plain -in ./update.tar.gz -out update.enc
openssl rsautl -encrypt -pubin -inkey ./rsa_public_key.pem -in key.plain -out key.enc
tar -cvf updateANDkey.tar update.enc key.enc

echo "update pkt success!"
